//
//  ViewController.m
//  BeiBei
//
//  Created by apple on 16/7/28.
//  Copyright © 2016年 XiaoYu. All rights reserved.
//

#import "ViewController.h"

#import "TodaysSaleViewController.h"
#import "GlobalPurchasingViewController.h"
#import "SpellGroupViewController.h"
#import "ShoppingCartViewController.h"
#import "MyViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    NSLog(@"最终项目");
    
    [self createTabBar];
}

-(void)createTabBar
{
    TodaysSaleViewController * tVC = [[TodaysSaleViewController alloc] init];
    tVC.tabBarItem.title = @"今日特价";
    tVC.tabBarItem.image = [UIImage imageNamed:@"ic_tabbar_sale_n"];
    tVC.tabBarItem.selectedImage = [UIImage imageNamed:@"ic_tabbar_sale_h"];
    UINavigationController * tNav = [[UINavigationController alloc] initWithRootViewController:tVC];
    
    GlobalPurchasingViewController * gVC = [[GlobalPurchasingViewController alloc] init];
    gVC.tabBarItem.title = @"全球购";
    gVC.tabBarItem.image = [UIImage imageNamed:@"ic_tabbar_global_n"];
    gVC.tabBarItem.selectedImage = [UIImage imageNamed:@"ic_tabbar_global_h"];
    UINavigationController * gNav = [[UINavigationController alloc] initWithRootViewController:gVC];
    
    SpellGroupViewController * spVC = [[SpellGroupViewController alloc] init];
    spVC.tabBarItem.title = @"拼团";
    spVC.tabBarItem.image = [UIImage imageNamed:@"ic_tabbar_tuan_n"];
    spVC.tabBarItem.selectedImage = [UIImage imageNamed:@"ic_tabbar_tuan_h"];
    UINavigationController * spNav = [[UINavigationController alloc] initWithRootViewController:spVC];
    
    ShoppingCartViewController * shVC = [[ShoppingCartViewController alloc] init];
    shVC.tabBarItem.title = @"购物车";
    shVC.tabBarItem.image = [UIImage imageNamed:@"ic_tabbar_cart_n"];
    shVC.tabBarItem.selectedImage = [UIImage imageNamed:@"ic_tabbar_cart_h"];
    UINavigationController * shNav = [[UINavigationController alloc] initWithRootViewController:shVC];
    
    MyViewController * mVC = [[MyViewController alloc] init];
    mVC.tabBarItem.title = @"我的";
    mVC.tabBarItem.image = [UIImage imageNamed:@"ic_tabbar_mine_n"];
    mVC.tabBarItem.selectedImage = [UIImage imageNamed:@"ic_tabbar_mine_h"];
    UINavigationController * mNav = [[UINavigationController alloc] initWithRootViewController:mVC];
    
    UITabBarController * tabbar = [[UITabBarController alloc] init];
    
    tabbar.tabBar.tintColor = [UIColor redColor];
    tabbar.viewControllers = @[tNav,gNav,spNav,shNav,mNav];
    
    WINDOW.rootViewController = tabbar;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
